package Sort;

import java.util.ArrayList;
import java.util.List;

/**
 * Description:
 * Author:    Dane
 * CreateTime:2024/8/26-上午10:05
 * Since  :   1.0
 * Version:   1.0
 */
public class MyReverse {

    public String reverse(String str){
        List<Character> list=new ArrayList<>();
        for(char c:str.toCharArray()){
            list.add(c);

        }
        StringBuffer stringBuffer = new StringBuffer();
        for(int i=list.size()-1;i>0;i--){
            stringBuffer.append(list.get(i));
        }
        return stringBuffer.toString();

    }
    public  String reverse2(String str){
        StringBuffer stringBuffer = new StringBuffer();
        for(int i=str.length()-1;i>=0;i--){
            stringBuffer.append(str.charAt(i));
        }
        return  stringBuffer.toString();
    }

    public static void main(String[] args) {
        MyReverse myReverse = new MyReverse();
        System.out.println(myReverse.reverse2("lwf"));
    }


}
